package com.atguigu.practice;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class StringTest {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String s1=scanner.nextLine();
        String s2=scanner.nextLine();
        Set<Character> set=new HashSet<>();
        for(int i=0;i<s2.length();i++){
            set.add(s2.charAt(i));
        }
        StringBuilder res=new StringBuilder();
        for(int i=0;i<s1.length();i++){
            char ch=s1.charAt(i);
            if(!set.contains(ch)||ch==' ') {
                res.append(ch);
            }
        }
        System.out.println(res.toString());
    }
}
